package com.example.androidcomplete0102.ch19;

import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import com.example.androidcomplete0102.R;

public class Ch19_Main extends ListActivity {
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		ArrayAdapter adapter = ArrayAdapter.createFromResource(this, R.array.chapter19, android.R.layout.simple_list_item_1);
		setListAdapter(adapter);
	}
	
	@Override
	protected void onListItemClick(ListView l, View v, int position, long id) {
		super.onListItemClick(l, v, position, id);
		
		
		Intent intent = null;
		switch(position){
		case 0: intent = new Intent(this, ThreadEx.class);
		break;
		case 1: intent = new Intent(this, HandlerEx.class);
		break;
		case 2: intent = new Intent(this, PostEx.class);
		break;
		case 3: intent = new Intent(this, RunOnEx.class);
		break;
		case 4: intent = new Intent(this, HanlderDivide.class);
		break;
		case 5: intent = new Intent(this, LooperEx.class);
		break;
		case 6: intent = new Intent(this, UploadEx.class);
		break;
		case 7: intent = new Intent(this, UploadDelay.class);
		break;
		case 8: intent = new Intent(this, UploadPostDelay.class);
		break;
		case 9: intent = new Intent(this, UploadViewPostDelay.class);
		break;
		case 10: intent = new Intent(this, LongTime1.class);
		break;
		case 11: intent = new Intent(this, LongTime2.class);
		break;
		case 12: intent = new Intent(this, LongTime3.class);
		break;
		case 13: intent = new Intent(this, LongTime4.class);
		break;
		case 14: intent = new Intent(this, LongTime5.class);
		break;
		case 15: intent = new Intent(this, BackWork1.class);
		break;
		case 16: intent = new Intent(this, BackWork2.class);
		break;
		}	
		startActivity(intent);
	}
}
